<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function show(){
				var _cid=cid.value;
				
				var xhr=new XMLHttpRequest();
				xhr.open("get",`/shopping/v1/shopping_search/${_cid}`,true);
				xhr.send();
				xhr.onreadystatechange=function(){
					if(xhr.readyState==4 && xhr.status==200){
						var r=xhr.responseText;
						var arr=JSON.parse(r);
								var strHTML=`
								<table border="1" bordercolor="purple" width="800" align="center">
									<tr>
										<th>编号</th>
										<th>使用者id</th>
										<th>商品id</th>
										<th>数量</th>
									</tr>
								`;
								for(var i=0;i<arr.length;i++){
								strHTML+=`
								<tr>
									<td>${arr[i].cid}</td>
									<td>${arr[i].user_id}</td>
									<td>${arr[i].product_id}</td>
									<td>${arr[i].count}</td>
								</tr>
								`
								}
								strHTML+="</table>";
								d1.innerHTML=strHTML;
								}
								if(r==0){
									d1.innerHTML="查无此人"
								}
								
							}
						}
		</script>
	</head>
	<body>
		<input type="text" id="cid">编号<br>
		<button onclick="show()">查询</button>
		<div id="d1"></div>
	</body>
</html>
